/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phd.dupenois.changeidentifiers;

import java.util.HashMap;

/**
 *
 * @author mpd209
 */
public class ChangeIdentifierSetSnapshot {

    /**
     * @return the start
     */
    public long getStart() {
        return start;
    }

    /**
     * @return the timeTaken
     */
    public long getTimeTaken() {
        return timeTaken;
    }

    /**
     * @param timeTaken the timeTaken to set
     */
    public void setTimeTaken(long timeTaken) {
        this.timeTaken = timeTaken;
    }

    
    public static class ChangeIdentifierSnapshot{
        private String classname;
        private double value;
        private boolean causedRedraw;
        private boolean fail;
        private long started;
        private long timeTaken;
        public ChangeIdentifierSnapshot(String name, double value, boolean fail, 
                boolean causedRedraw, long started, long timeTaken){
            this.classname= name;
            this.value = value;
            this.fail = fail;
            this.causedRedraw = causedRedraw;
            this.started = started;
            this.timeTaken = timeTaken;
        }

        /**
         * @return the classname
         */
        public String getClassname() {
            return classname;
        }

        /**
         * @return the value
         */
        public double getValue() {
            return value;
        }

        /**
         * @return the causedRedraw
         */
        public boolean isCausedRedraw() {
            return causedRedraw;
        }

        /**
         * @return the fail
         */
        public boolean isFail() {
            return fail;
        }

        /**
         * @return the started
         */
        public long getStarted() {
            return started;
        }

        /**
         * @return the timeTaken
         */
        public long getTimeTaken() {
            return timeTaken;
        }

       
    }
    private HashMap<String, ChangeIdentifierSnapshot> changeIdentifierSnapshots;
    private boolean redraw;
    private double value;
    private int failcount;
    private long start;
    private long timeTaken;
    public ChangeIdentifierSetSnapshot(long start){
        changeIdentifierSnapshots = new HashMap<String, ChangeIdentifierSnapshot>();
        this.start = start;
    }

    public void addChangeIdentifier(String name, double value, boolean fail, boolean causedRedraw, long started, long timeTaken){
        getChangeIdentifierSnapshots().put(name, new ChangeIdentifierSnapshot(name, 
                value, fail, causedRedraw, started, timeTaken));
    }
    public ChangeIdentifierSnapshot getChangeIdentifier(String name){
        return getChangeIdentifierSnapshots().get(name);
    }
    /**
     * @return the changeIdentifierSnapshots
     */
    public HashMap<String, ChangeIdentifierSnapshot> getChangeIdentifierSnapshots() {
        return changeIdentifierSnapshots;
    }
    /**
     * @return the changeIdentifierSnapshots
     */
    public ChangeIdentifierSnapshot[] getChangeIdentifierSnapshotsArray() {
        return changeIdentifierSnapshots.values().toArray(new ChangeIdentifierSnapshot[changeIdentifierSnapshots.size()]);
    }
    /**
     * @return the redraw
     */
    public boolean isRedraw() {
        return redraw;
    }

    /**
     * @param redraw the redraw to set
     */
    public void setRedraw(boolean redraw) {
        this.redraw = redraw;
    }

    /**
     * @return the value
     */
    public double getValue() {
        return value;
    }

    /**
     * @param value the value to set
     */
    public void setValue(double value) {
        this.value = value;
    }

    /**
     * @return the failcount
     */
    public int getFailcount() {
        return failcount;
    }

    /**
     * @param failcount the failcount to set
     */
    public void setFailcount(int failcount) {
        this.failcount = failcount;
    }

}
